package pl.vm.model;

import java.util.LinkedList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

@NamedQuery(
		name = "officialTeamSize", 
		query = "select S.officialTeams from Seazon S where S.id = :id"
)
@Entity
public class Seazon {

	@Id
	@GeneratedValue
	private Long id;
	private String name;
	@OneToMany(cascade={CascadeType.ALL})
	private List<OfficialTeam> officialTeams = new LinkedList<>();
	@OneToMany(cascade={CascadeType.ALL})
	private List<Round> rounds = new LinkedList<>();
	@OneToMany(cascade={CascadeType.ALL})	
	private List<TeamPoint> teamPoints = new LinkedList<>();
	@OneToMany(cascade={CascadeType.ALL})
	private List<PlayerPoint> playerPoints = new LinkedList<>();
	@OneToOne(cascade={CascadeType.ALL})
	private Round actualRound;
	
	public Seazon() {}
	public Seazon(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Round getActualRound() {
		return actualRound;
	}
	public void setActualRound(Round actualRound) {
		this.actualRound = actualRound;
	}
	public List<OfficialTeam> getOfficialTeams() {
		return officialTeams;
	}
	public List<Round> getRounds() {
		return rounds;
	}
	public List<TeamPoint> getTeamPoints() {
		return teamPoints;
	}
	public List<PlayerPoint> getPlayerPoints() {
		return playerPoints;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}
